﻿// -----------------------------------------------------------------------
// <copyright file="DirectoryInfoTest.cs" company="Company">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------


using System.Security.AccessControl;
using Company.IO.Interfaces;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Company.System.IO.IntegrationTests
{
    /// <summary>
    /// TODO: Update summary.
    /// </summary>
    public partial class DirectoryInfoTest : TestBase<IDirectoryInfo>
    {
        [TestMethod]
        [Ignore]
        public void Create_PathValid_DirectoryExists()
        {
            //Arrange
            string path = string.Format("{0}DIRECTORYINFO_CREATE\\", _SLocalPath);
            IDirectoryInfo directoryInfo = new DirectoryInfo(new global::System.IO.DirectoryInfo(path));
            Assert.IsFalse(global::System.IO.Directory.Exists(path));

            //Act
            directoryInfo.Create();

            //Assert
            Assert.IsTrue(global::System.IO.Directory.Exists(path));
        }

        [TestMethod]
        [Ignore]
        public void Create_PathValidDirectorySecurity_DirectoryExists()
        {
            //Arrange
            string path = string.Format("{0}DIRECTORYINFO_CREATE\\", _SLocalPath);

            var directorySecurity = new DirectorySecurity();
            directorySecurity.AddAccessRule(new FileSystemAccessRule("Administrator", FileSystemRights.FullControl,
                                                                     AccessControlType.Allow));

            IDirectoryInfo directoryInfo = new DirectoryInfo(new global::System.IO.DirectoryInfo(path));
            Assert.IsFalse(global::System.IO.Directory.Exists(path));

            //Act
            directoryInfo.Create(directorySecurity);

            //Assert
            Assert.IsTrue(global::System.IO.Directory.Exists(path));
        }
    }
}